home *** CD-ROM | disk | FTP | other *** search
- /* Routines for the credits box... */
-
- #include "demo.h"
-
- /***********************************************************************\
- | void Bold_Button( dPtr, itemNum ) |
- |-----------------------------------------------------------------------|
- | Purpose :: To draw a thick black line around any dialog box item. |
- |-----------------------------------------------------------------------|
- | Arguments :: |
- | dPtr -> Pointer to an already opened window. |
- | itemNum -> Item within the dialog to highlight. |
- |-----------------------------------------------------------------------|
- | Returns :: void. |
- \***********************************************************************/
-
- void Bold_Button( dPtr, itemNum )
- DialogPtr dPtr;
- int itemNum;
- {
- Rect iBox; /* The rectangle for the button */
- int iType; /* Type of dialog item */
- Handle iHandle; /* Pointer to the item */
- PenState oldPenState; /* Preserve the old drawing state */
-
- SystemTask();
- SetPort(dPtr);
- GetPenState(&oldPenState);
- GetDItem(dPtr, itemNum, &iType, &iHandle, &iBox);
- InsetRect(&iBox, -4, -4);
- PenSize(3,3);
- FrameRoundRect(&iBox, 16, 16);
- SetPenState(&oldPenState);
- }
-
-
- /***********************************************************************\
- | void Center_Window( theWindow, bumpUp ) |
- |-----------------------------------------------------------------------|
- | Purpose :: To center a currently opened - but still invisible - |
- | window on the screen. Once the window is centered, it |
- | should then be made visible for the user. |
- |-----------------------------------------------------------------------|
- | Arguments :: |
- | theWindow -> Pointer to an already opened window. |
- | bumpUp -> A percentage from center to move the window up. |
- | Sometimes a perfectly centered window (bumpUp=0) is |
- | annoying to a user, so I provide this facility. Note |
- | that a negative value will push the window down. |
- | isModeless -> If so, add an additional 20 pixels for the drag bar. |
- |-----------------------------------------------------------------------|
- | Returns :: void. |
- \***********************************************************************/
-
- void Center_Window(theWindow,bumpUp,isModeless)
- DialogPtr theWindow;
- int bumpUp;
- Boolean isModeless;
- {
- Rect tempRect; /* Temporary rectangle */
- int pixels; /* Raise from center this amount */
- int menuBar = 20; /* Compensate 20 pixels for menu bar */
-
- /* Compute centering information */
- tempRect.top = theWindow->portRect.top;
- tempRect.left = theWindow->portRect.left;
- tempRect.bottom = theWindow->portRect.bottom;
- tempRect.right = theWindow->portRect.right;
- tempRect.top = ((screenBits.bounds.bottom + menuBar + (isModeless ? 20 : 0) -
- screenBits.bounds.top) - (tempRect.bottom - tempRect.top)) / 2;
- tempRect.left = ((screenBits.bounds.right - screenBits.bounds.left) -
- (tempRect.right - tempRect.left)) / 2;
-
- /* Apply any bump-up factor */
- pixels = tempRect.top * (bumpUp / 100.0);
- tempRect.top = tempRect.top - pixels;
-
- /* Now center window & make it visible */
- MoveWindow(theWindow, tempRect.left, tempRect.top, TRUE);
- SetPort(theWindow);
- }
-
-